package com.yoso.springcloud.controller;

import com.yoso.springcloud.domain.CommonResult;
import com.yoso.springcloud.domain.Payment;
import com.yoso.springcloud.service.PaymentService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Description:
 * @Date: 2021/10/12 17:29
 */
@RestController
public class PaymentController {
    @Resource
    private PaymentService paymentService;
    @Value("${server.port}")
    private String port;
    @PostMapping("/payment/save")
    public CommonResult<Payment> save(@RequestBody  Payment payment){
        System.out.println("port = " + port);
        Payment result = paymentService.save(payment);
        return new CommonResult<>(result,port);
    }
    @GetMapping("/payment/get/{id}")
    public CommonResult<Payment> getPaymentById(@PathVariable("id") Long id){
        System.out.println("port = " + port);
        Payment result = paymentService.getPaymentById(id);
        return new CommonResult<>(result,port);
    }
}
